package com.shop.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shop.entity.CommonUser;
import com.shop.entity.MerchantMerchant;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MerchantMapper extends BaseMapper<MerchantMerchant> {

    @Select("select * from merchant_merchant where id = #{id} and is_deleted = 0 and merchant_status = 1")
    MerchantMerchant getMerchantById(Integer id);

    //高级检索
    List<MerchantMerchant> superSearch(String superSearchKeyWord);

    //条件查询
    List<MerchantMerchant> queryAllByModel(MerchantMerchant model);

    //修改商户状态
    Integer changeStatus(MerchantMerchant merchantMerchant);

    //修改商户审核状态
    Integer changeExamineStatus(MerchantMerchant merchantMerchant);

    //根据id逻辑删除
    Integer deleteOne(Integer id);

    //根据用户名查询 用户
    CommonUser getUserByAccount(String account);


    //判断账户是否不存在
    Integer accountIsExist(String account);

    //判断电话是否存在
    Integer phoneIsExist(String merchantPhone);

    //添加账号
    Integer addCommonUser(CommonUser commonUser);

    //添加商户信息
    Integer insertOne(MerchantMerchant merchant);



}
